// UhfReaderDlg.h : header file
//

#if !defined(AFX_UHFREADERDLG_H__9C87C73F_24E7_42C4_BF88_AD6418920445__INCLUDED_)
#define AFX_UHFREADERDLG_H__9C87C73F_24E7_42C4_BF88_AD6418920445__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <list>
#include "common.h"
#include "MyButton.h"
/////////////////////////////////////////////////////////////////////////////
// CUhfReaderDlg dialog

class CListTag6C
{
public:
	int m_iIndex;
	BYTE m_bTagID[128];
	int m_iTagLen;
	CString m_strTagID;
	CListTag6C()
	{
		memset(m_bTagID, 0, 128);
		m_strTagID = "";
	}
	CListTag6C &operator=(CListTag6C &tag)
	{
		m_iTagLen = tag.m_iTagLen;
		memcpy(m_bTagID, tag.m_bTagID, m_iTagLen);
		m_strTagID = tag.m_strTagID;
	}
protected:
private:
};

class CUhfReaderDlg : public CDialog
{
// Construction
public:
	CUhfReaderDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CUhfReaderDlg)
	enum { IDD = IDD_UHFREADER_DIALOG };
	CComboBox	m_start_byte;
	CComboBox	m_out_len;
	CIPAddressCtrl	m_reader_ip;
	CIPAddressCtrl	m_host_ip;
	CComboBox	m_power;
	CComboBox	m_start_rf;
	CComboBox	m_end_rf;
	CComboBox	m_language;
	CMyButton	m_btnOK;
	CMyButton	m_btnCancel;
	CMyButton	m_btnDisable;
	CMyButton	m_btnFocus;
	CMyButton	m_btnOver;
	CMyButton	m_btnNormal;
	CMyButton m_connect;
	CMyButton m_disconnect;
	CMyButton m_readconfig;
	CMyButton m_factorydefault;
	CMyButton m_savechange;
	CMyButton m_testcard;
	CListCtrl	m_List6cID;
	CComboBox	m_comboBaud;
	CComboBox	m_cbBaud;
	CComboBox	m_cbCom;
	BOOL	m_chkListID;
	CString	m_status_display;
	CString	m_password;
	UINT	m_readcard_delaytime;
	BYTE	m_OutPowerValue;
	BYTE	m_wg_time;
	BYTE	m_address;
	BYTE	m_trigger_time;
	CString	m_version;
	UINT	m_host_port;
	UINT	m_reader_port;
	CString	m_sernum;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CUhfReaderDlg)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CUhfReaderDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnBtnConnect();
	afx_msg void OnBtnCloseport();
	afx_msg void OnBtnSetdefault();
	afx_msg void OnClose();
	afx_msg void OnBtnReadtag();
	afx_msg void OnDblclkListCg(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnBtnSave();
	afx_msg void OnReadConfig();
	afx_msg void OnRadioAllways();
	afx_msg void OnRadioTriggerRead();
	afx_msg void OnChangeEditReadcardDelaytime();
	afx_msg void OnChangeEditWgOutByte();
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
	afx_msg void OnSettingAddress();
	afx_msg void OnGetAddress();
	afx_msg void OnReadTag2();
	afx_msg void OnReadTag16();
	afx_msg void OnRadioFcc();
	afx_msg void OnRadioEtsi();
	afx_msg void OnRadioWg26();
	afx_msg void OnRadioWg34();
	afx_msg void OnReadTagUsb();
	afx_msg void OnRadioUsb();
	afx_msg void OnRadioCom();
	afx_msg void OnRadioTcp();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	void EnableAllButton(BOOL bEnable);
	int UhfReadConfig();
	int SaveWeigand();
	int SetTriggerMode();
	int SetWorkMode();
	int SetBuzzerLed();
	int SetWeigand();
	int SetBaud();
	int SetTime();
	int SaveFreqAndPower();
	void OnCbnSetFre(int sel, int imin, int imax);
	void OnCbnSetFreold(int sel, int imin, int imax);

	int EpgGetTag();
	static UINT EpgGetTagThread(void *lpVoid);
	void RuhfReadTag(void *data, DWORD dwLen);
	void RuhfReadTag2(void *data, DWORD dwLen);
	int m_IsOpen;

	std::list<CListTag6C> m_listTag;
	CListTag6C m_tag6C;
	
	int m_epcLen;
	int m_rdListRegion;

	HANDLE m_hEpccEvent;
	volatile int m_iAutoReadFlag;
	volatile int m_IsExitReadEPC;
	BYTE m_bFre;
	ReaderBasicParam basicParam;
	ReaderBasicParam defaultParam;
	BYTE defaultFre;
	int m_wg34;
};


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_UHFREADERDLG_H__9C87C73F_24E7_42C4_BF88_AD6418920445__INCLUDED_)
